<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
	<head>
		<title>Price Form</title>
		<script src='<c:url value="/js/jquery/jquery-3.3.1.min.js" />'></script>
		<script src='/js/car/carPrice.js'></script>
	</head>
	<body>
		<h2>Get Your Car Price</h2>
		<form:form modelAttribute="carPriceRequest" action="/price" method="POST">
			<table>
				<tr>
					<td>Car Brand</td>
					<td>
						<form:select path="brands" id="brands" multiple="true" onchange="brandsUpdated();">
							<form:option value="ALL">ALL</form:option>
							<form:options items="${brandList}" itemLabel="name" itemValue="id"/>
						</form:select>
					</td>
				</tr>
				
				<tr>
					<td>Car Product</td>
					<td>
						<form:select path="products" id="products" multiple="true" onchange="productsUpdated();" onfocus="updateSelectOptions(this);">
							<form:option value="ALL">ALL</form:option>
							<form:options items="${productList}" itemLabel="name" itemValue="id"/>
						</form:select>
					</td>
				</tr>
				
				<tr>
					<td>Car Displacement</td>
					<td>
						<form:select path="displacements" id="displacements" multiple="true" onfocus="updateSelectOptions(this);">
							<form:option value="ALL">ALL</form:option>
							<form:options items="${displacementList}" itemLabel="name" itemValue="id"/>
						</form:select>
					</td>
				</tr>
				
			</table>
		</form:form>
	</body>
</html>
